package com.zyk.service;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import entity.Product;
//value属性用来指定调用的微服务的名称 就是yml文件中指定的spring.application.name
@FeignClient(value="microservice-product",fallback=ProductClientServiceFallBack.class)
public interface ProductClientService {
	@RequestMapping(value="/product/get/{id}",method=RequestMethod.GET)
	//@FeignClient接口方法有基本类型参数在参数必须加@PathVariable("XXX") 或 @RequestParam("XXX")
	Product get(@PathVariable(value="id")Long id);
	@RequestMapping(value = "/product/list", method = RequestMethod.GET)
	List<Product> list();
	@RequestMapping(value = "/product/add", method = RequestMethod.POST)
	boolean add(Product product);
}
